package com.moto.service.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.moto.entity.PostsTrade;
import com.moto.repository.PostsTradeRepository;
import com.moto.service.PostsTradeService;

@Service("postsTradeService")
public class PostsTradeServiceImpl implements PostsTradeService {
	
	private static final Logger LOG = Logger.getLogger(PostsTradeServiceImpl.class);
	
	@Autowired
	private PostsTradeRepository postsTradeRepository; 

	@Override
	public int deleteByPrimaryKey(String pId) {
		LOG.info("deleteByPrimaryKey，参数：pid = "+pId);
		return postsTradeRepository.deleteByPrimaryKey(pId);
	}

	@Override
	public int insert(PostsTrade record) {
		LOG.info("insert ,参数：record = "+record.toString());
		return postsTradeRepository.insert(record);
	}

	@Override
	public int insertSelective(PostsTrade record) {
		LOG.info("插入交易贴 ,参数：record = "+record.toString());
		return postsTradeRepository.insertSelective(record);
	}

	@Override
	public PostsTrade selectByPrimaryKey(String pId) {
		LOG.info("查询交易贴详情 ,参数：pId = "+pId);
		return postsTradeRepository.selectByPostsId(pId);
	}

	@Override
	public int updateByPrimaryKeySelective(PostsTrade record) {
		LOG.info("更新交易贴 ,参数：record = "+record.toString());
		return postsTradeRepository.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(PostsTrade record) {
		LOG.info("更新交易贴 ,参数：record = "+record.toString());
		return postsTradeRepository.updateByPrimaryKey(record);
	}

	@Override
	public int deleteByPostsId(String postsId) {
		LOG.info("删除交易贴，帖子ID = "+postsId);
		return postsTradeRepository.deleteByPostsId(postsId);
	}

	@Override
	public PostsTrade selectByPostsId(String postsId) {
		LOG.info("根據帖子ID查詢帖子信息,帖子ID = "+postsId);
		return postsTradeRepository.selectByPostsId(postsId);
	}

}
